/*
 * LinkedListImpl.h
 *
 *  Created on: Apr 25, 2012
 *      Author: REZNIK
 */

#ifndef LINKEDLISTIMPL_H_
#define LINKEDLISTIMPL_H_

#include "List.h"
#include "NodeHead.h"
#include "NodeTail.h"

namespace cs236703_spring2012_hw2{

class LinkedListImpl : public List
{
private:
	NodeHead head;
	NodeTail tail;
	long version;
	int size;
public:
	LinkedListImpl();
	~LinkedListImpl();
	virtual Iterator* GetIterator();
	// Get the content version. The version is updated on every addition or delete.
	virtual int GetVersion() const;
	void UpdateVersion();
	Node* getNewNode(int i, bool immutable);
	void removeNode(Node* node);
	bool isEmpty(){ return size==0; }
	// Add a new element at the beginning of the list
	virtual void AddToFront(int i, bool immutable = true);
	// Add a new element at the end of the list
	virtual void AddToBack(int i, bool immutable = true);
};

}

#endif /* LINKEDLISTIMPL_H_ */
